// const express = require('express');
// const path = require('path');

import express from 'express';

import path from 'path';

import { createProxyMiddleware as proxy } from 'http-proxy-middleware';

import fallback from 'express-history-api-fallback';

const app = express();

app.use(express.static(path.resolve('dist')));

app.use('/api', proxy({ target: 'http://ihrm.itheima.net/', changeOrigin: true }));

app.use(fallback('index.html', { root: path.resolve('dist') }));

app.listen(3000, () => {
  console.log('server started at http://localhost:3000/');
});
